# MASTER PROMPT V2 — MARKET INFLUENCE KNOWLEDGE GRAPH ENHANCEMENT ## IMPORTANT This specification extends the previously supplied: **Ontology-Driven Real-Time Market Stream Reasoning, Regime Detection, Explainable Signal Engine, Agents, Skills, Docker Deployment Master Prompt.** ALL previous requirements remain mandatory. Nothing from the original prompt should be removed. Where this specification conflicts with the earlier graph architecture, this version takes precedence. The implementation must now make the **Market Influence Knowledge Graph** one of the central components of the application. --- # 1. PRIMARY CONCEPT The financial market must be represented as a hierarchical but interconnected semantic graph. The primary navigation hierarchy is: ```text LEVEL 0 US MARKET │ ▼ LEVEL 1 ALL MARKET SECTORS │ ▼ LEVEL 2 ALL RELEVANT STOCKS / ETFs / INDICES │ ▼ LEVEL 3 ALL REAL-TIME FACTORS THAT CAN AFFECT THE MOVEMENT OF EACH INSTRUMENT ``` However, this MUST NOT be implemented as a simple rigid tree. It is a **multi-relational temporal knowledge graph**. For example: ```text QQQ ├── Technology ├── Communication Services └── Consumer Discretionary exposure ``` and: ```text 10-Year Treasury Yield │ ├── influences QQQ ├── influences SPY ├── influences XLK ├── influences NVDA └── influences TSLA ``` A single factor can affect: ```text multiple stocks multiple ETFs multiple sectors the entire US market ``` Likewise, an ETF can contain companies from multiple industries or sectors. The ontology must therefore maintain the requested logical hierarchy while supporting many-to-many graph relationships. --- # 2. MARKET INFLUENCE GRAPH Implement the following conceptual graph: ```text LEVEL 0 US MARKET │ ┌────────────────┼────────────────┐ │ │ │ ▼ ▼ ▼ Sector Sector Sector Technology Financials Energy │ │ LEVEL 1 │ ▼ ┌───────────────┐ │ │ ▼ ▼ QQQ XLK NVDA AAPL MSFT META TSLA etc. │ │ LEVEL 2 │ ▼ REAL-TIME CONTRIBUTING FACTORS │ ├── Technical ├── Price Action ├── Volume ├── Options ├── Market Microstructure ├── Macro ├── Microeconomic ├── Fundamentals ├── SEC Filings ├── News ├── Social Media ├── Executive/Owner Statements ├── Analyst Activity ├── Sector Conditions ├── ETF Holdings ├── Cross-Asset Factors ├── Sentiment ├── Event Risk └── Other calculated factors │ │ LEVEL 3 ▼ EVIDENCE GRAPH │ ▼ REGIME ENGINE │ ▼ STRATEGY ENGINE │ ▼ RISK ENGINE │ ▼ BUY / SELL / HOLD / HEDGE ``` --- # 3. LEVEL 0 — US MARKET Create: ```text USMarket ``` as a first-class ontology entity. Example: ```turtle market:USMarket a market:Market ; skos:prefLabel "United States Equity Market" . ``` Level 0 must aggregate information from: ```text SPY QQQ DIA IWM major indices all sectors Treasury yields VIX DXY market breadth credit conditions macro events liquidity conditions market-wide news economic policy ``` The system must continuously infer an overall: ```text USMarketRegimeObservation ``` Examples: ```text STRONG_RISK_ON RISK_ON BULLISH NEUTRAL TRANSITION BEARISH RISK_OFF STRONG_RISK_OFF HIGH_VOLATILITY EVENT_DRIVEN ``` --- # 4. LEVEL 1 — ALL SECTORS Create a Sector taxonomy. Examples include: ```text Technology Financials Healthcare Energy Industrials Utilities Materials Real Estate Consumer Staples Consumer Discretionary Communication Services ``` Do not tightly couple code to a hard-coded taxonomy. Represent taxonomy semantically using SKOS where appropriate. Example: ```turtle sector:Technology a market:Sector ; skos:prefLabel "Technology" . ``` Each sector must have: ```text sector regime sector breadth relative strength momentum ETF representation constituent performance earnings influence macro sensitivity Treasury sensitivity commodity sensitivity currency sensitivity news sentiment options activity ``` Create: ```text SectorRegimeObservation ``` --- # 5. LEVEL 2 — STOCK / ETF / INDEX Represent: ```text Equity ETF Index ADR Future OptionUnderlying ``` At minimum the initial application should support: ```text SPY QQQ TSLA NVDA AAPL MSFT AMZN META GOOGL AMD IWM DIA and sector ETFs. ``` The architecture must allow thousands of instruments without ontology redesign. Instrument properties may include: ```text ticker company asset type exchange sector industry market capitalization ETF membership index membership ETF holdings weight country currency beta volatility profile ``` --- # 6. ETF GRAPH MODEL ETF relationships are extremely important. Example: ```text QQQ │ ├── tracks → NASDAQ-100 │ ├── hasHolding → NVDA │ ├── hasHolding → AAPL │ ├── hasHolding → MSFT │ └── hasHolding → AMZN ``` Each holding relationship should optionally contain: ```text weight effective date source confidence ``` The reasoning engine must support propagation such as: ```text NVDA strong bullish + Semiconductor sector bullish + NVDA has significant QQQ weight → positive contribution to QQQ regime ``` The contribution must be weighted. --- # 7. LEVEL 3 — REAL-TIME CONTRIBUTING FACTORS This is the most important enhancement. Every stock/ETF must have a dynamic collection of factors that currently influence its movement. Do NOT create one gigantic undifferentiated factor table. Create a semantic factor hierarchy. --- # 8. FACTOR ONTOLOGY Create: ```text MarketFactor ``` with subclasses: ```text TechnicalFactor PriceActionFactor VolumeFactor MomentumFactor VolatilityFactor OptionsFactor MarketMicrostructureFactor MacroEconomicFactor MicroEconomicFactor FundamentalFactor FinancialStatementFactor SECFilingFactor NewsFactor SocialMediaFactor ExecutiveCommunicationFactor AnalystFactor SentimentFactor SectorFactor IndustryFactor ETFExposureFactor CrossAssetFactor TreasuryFactor CurrencyFactor CommodityFactor GeopoliticalFactor RegulatoryFactor EventRiskFactor LiquidityFactor AlternativeDataFactor ``` --- # 9. FACTOR DEFINITION VS FACTOR OBSERVATION This separation is mandatory. Do NOT repeatedly create definitions such as: ```text MACD EMA9 CPI NFP ``` for every event. Create stable: ```text FactorDefinition ``` and dynamic: ```text FactorObservation ``` Example: ```text FactorDefinition MACD ``` versus: ```text FactorObservation Instrument: QQQ Factor: MACD Value: +1.24 State: BULLISH_CROSSOVER Timestamp: T Confidence: 0.93 ``` --- # 10. TECHNICAL FACTORS At minimum support: ```text MA5 MA9 EMA5 EMA9 EMA20 EMA50 EMA100 EMA200 SMA5 SMA9 SMA20 SMA50 SMA100 SMA200 MACD MACD Signal MACD Histogram RSI Bollinger Bands Bollinger Band Width VWAP Anchored VWAP ATR ADX Stochastic ROC Momentum OBV Volume Profile Relative Volume Pivot Points Support Resistance Previous Day High Previous Day Low Premarket High Premarket Low 52-week High All-Time High Gap Breakout Breakdown Retest Trend Strength ``` The requested: ```text 5 MA / 9 MA ``` strategy must be explicitly implemented. Example: ```text MA5 crosses above MA9 → BullishMomentumEvidence ``` but only after configurable confirmation such as: ```text volume confirmation price > VWAP persistence ``` when configured. --- # 11. MULTI-ALGORITHM FACTOR MODEL Each algorithm must produce an independent observation. Example: ```text QQQ MA5/9 +0.71 MACD +0.62 Bollinger +0.38 VWAP +0.81 RSI +0.31 Volume +0.66 Breakout +0.77 ``` Do NOT collapse algorithms prematurely. Keep every factor observable and explainable. --- # 12. PRICE ACTION FACTORS Support: ```text trend breakout breakdown reversal higher high higher low lower high lower low gap up gap down support hold support failure resistance rejection resistance breakout VWAP reclaim VWAP rejection momentum acceleration momentum exhaustion ``` --- # 13. MARKET MICROSTRUCTURE Where data is available include: ```text bid ask spread bid size ask size order imbalance trade direction trade velocity liquidity large trade detection sweep detection block trade market depth volume imbalance ``` Do not assume unavailable data exists. Use provider capability discovery. --- # 14. OPTIONS FACTORS Include: ```text Call Volume Put Volume Put/Call Ratio Open Interest OI change IV IV change IV percentile IV rank Gamma Exposure Delta Exposure Vanna Charm Skew Term Structure Unusual Options Flow Large Premium Call Sweep Put Sweep Expected Move Dealer Gamma Regime ``` Generate independent evidence. --- # 15. MACROECONOMIC FACTORS Include: ```text Federal Reserve policy Fed Funds expectations 2-Year Treasury 10-Year Treasury 30-Year Treasury yield curve CPI Core CPI PPI PCE Core PCE Nonfarm Payroll Unemployment Average Hourly Earnings Initial Jobless Claims JOLTS GDP ISM Manufacturing ISM Services Retail Sales Consumer Confidence Industrial Production Housing data Treasury auctions M2/liquidity where appropriate DXY VIX ``` Macro events must use: ```text expected actual previous revision surprise surpriseZScore ``` where available. --- # 16. MICROECONOMIC / COMPANY FACTORS Include company-specific factors such as: ```text earnings EPS surprise revenue surprise forward guidance margin changes free cash flow capital expenditure product launch product cancellation production numbers sales deliveries management guidance customer growth supply-chain issues layoffs hiring M&A lawsuits regulatory actions patent issues product recalls insider transactions management changes board changes ``` --- # 17. FUNDAMENTAL FACTORS Support: ```text Revenue Revenue Growth EPS EPS Growth Gross Margin Operating Margin Net Margin EBITDA Free Cash Flow Operating Cash Flow Debt Cash Debt/Equity Current Ratio ROE ROA ROIC PE Forward PE PEG Price/Sales Price/Book EV/EBITDA Dividend Yield Share Dilution Buybacks Institutional Ownership Insider Ownership ``` Fundamental observations should have longer validity periods than tick-level factors. --- # 18. SEC FILINGS Interpret references to "K10" as **Form 10-K** unless explicitly configured otherwise. Create support for relevant filings such as: ```text 10-K 10-Q 8-K 13F 13D 13G Form 4 ``` When available and legally permitted, ingest and extract semantic events from filings. Model: ```text SECFiling ``` and: ```text FilingObservation ``` Extract: ```text risk factor changes revenue changes margin changes debt liquidity guidance litigation management discussion capital expenditure share repurchase material event ``` Never let an LLM directly generate trading facts from a filing without retaining source provenance. --- # 19. NEWS FACTORS Create a full News Intelligence pipeline. Pipeline: ```text NEWS INGESTION ↓ NORMALIZATION ↓ DEDUPLICATION ↓ ENTITY LINKING ↓ EVENT EXTRACTION ↓ CLAIM EXTRACTION ↓ SOURCE ASSESSMENT ↓ CORROBORATION ↓ SENTIMENT ↓ MARKET IMPACT ↓ FACTOR OBSERVATION ``` Each NewsObservation should include: ```text headline source publication timestamp ingestion timestamp symbols companies sectors event category sentiment sentiment confidence novelty urgency market relevance credibility score corroboration score source reliability expected direction impact magnitude expiration ``` --- # 20. FAKE-NEWS / MISINFORMATION FILTER The platform must attempt to filter unreliable information. However: DO NOT implement a simplistic: ```text fake = true ``` based only on LLM opinion. Create: ```text InformationCredibilityAssessment ``` Possible classifications: ```text VERIFIED_OFFICIAL HIGHLY_CORROBORATED CORROBORATED UNVERIFIED LOW_CREDIBILITY CONFLICTING_REPORTS LIKELY_MISINFORMATION SPAM BOT_AMPLIFICATION_SUSPECTED ``` Assess using multiple features. Examples: ```text source reputation official-source confirmation number of independent sources cross-source agreement publication history account identity URL/domain reliability semantic contradiction duplicate-network behavior claim novelty bot/spam indicators time of publication source proximity to event ``` Never claim absolute truth when evidence is uncertain. Store: ```text credibilityScore confidence supportingSources contradictingSources assessmentMethod assessmentVersion ``` --- # 21. SOCIAL MEDIA FACTORS Create social-media ingestion adapters. Potential sources can include: ```text X / Twitter where legally/API-accessible Reddit official company feeds executive public posts other permitted public sources ``` Architecture must be provider-independent. Do not depend on scraping that violates provider terms. --- # 22. EXECUTIVE / OWNER / MANAGEMENT POSTS This is important. Represent: ```text Person Company Role SocialAccount SocialPost ``` Relationships: ```text ElonMusk executiveOf Tesla ``` and: ```text SocialAccount represents Person ``` A post must be entity-linked. Example: ```text ExecutivePostObservation author company role account verifiedIdentity timestamp contentReference sentiment eventType marketRelevance credibility affectedInstrument ``` Examples of potentially meaningful events: ```text product announcement production update guidance-like statement regulatory comment business outlook acquisition statement technology announcement delivery statement ``` Executive social posts must NEVER automatically become BUY/SELL signals. They generate evidence. --- # 23. ANALYST FACTORS Include: ```text upgrade downgrade price target increase price target decrease coverage initiation estimate revision earnings estimate change ``` Store source and timestamp. --- # 24. REAL-TIME FACTOR OBSERVATION Every Level-3 observation should follow a common model. Example: ```json { "factorObservationId": "fo_123", "instrument": "QQQ", "factor": "MACD", "category": "TECHNICAL", "timestamp": "2026-09-04T10:31:15-04:00", "horizon": "5m", "value": 1.24, "normalizedScore": 0.62, "direction": "BULLISH", "magnitude": 0.71, "confidence": 0.93, "freshness": 0.99, "source": "stream-feature-engine", "validUntil": "..." } ``` --- # 25. FACTOR CONTRIBUTION MODEL Every factor should ultimately produce a normalized contribution. Recommended range: ```text -1.0 = maximally bearish contribution 0 = no directional contribution +1.0 = maximally bullish contribution ``` But also retain: ```text magnitude confidence freshness source credibility relevance ``` Example contribution: ```text FactorContribution = DirectionScore × Magnitude × Confidence × Freshness × Relevance × SourceCredibility × ContextWeight ``` All weights must be configurable. --- # 26. DO NOT DOUBLE COUNT CORRELATED FACTORS This is mandatory. For example: ```text MA5/9 bullish MACD bullish momentum bullish ``` may represent highly correlated evidence. Likewise: ```text NVDA bullish Semiconductors bullish SOXX bullish ``` may partially describe the same underlying movement. Implement: ```text factor families correlation groups dependency groups maximum category contribution ``` to reduce double counting. --- # 27. FACTOR GRAPH EXAMPLE — QQQ The graph should support: ```text QQQ │ ┌────────────────────┼────────────────────┐ │ │ │ ▼ ▼ ▼ TECHNICAL MACRO HOLDINGS │ │ │ ├─ MA5/9 ├─ NFP ├─ NVDA ├─ MACD ├─ CPI ├─ MSFT ├─ Bollinger ├─ 2Y Yield ├─ AAPL ├─ VWAP ├─ 10Y Yield └─ AMZN ├─ RSI ├─ Fed └─ Volume └─ DXY │ │ ├────────────── OPTIONS │ │ │ ├─ GEX │ ├─ IV │ ├─ Put/Call │ └─ Flow │ ├────────────── NEWS │ │ │ ├─ Company News │ ├─ Sector News │ ├─ Macro News │ └─ Credibility │ └────────────── SOCIAL │ ├─ Executive posts ├─ Company posts ├─ Market sentiment └─ Credibility ``` --- # 28. FACTOR → EVIDENCE Factor observations should produce Evidence entities. Example: ```text QQQ MA5 > MA9 │ ▼ BullishMomentumEvidence ``` Another: ```text QQQ > upper Bollinger AND volume weak AND RSI overextended │ ▼ ExhaustionRiskEvidence ``` Competing evidence must be retained. --- # 29. FACTOR → REGIME Do NOT infer: ```text MACD positive → QQQ bullish ``` Instead: ```text MACD MA5/9 VWAP Volume Options Sector Holdings Treasuries Macro News Fundamentals Social │ ▼ INDEPENDENT EVIDENCE │ ▼ WEIGHTING │ ▼ CORRELATION ADJUSTMENT │ ▼ CONFIDENCE │ ▼ REGIME SCORE ``` --- # 30. MARKET PROPAGATION Support both bottom-up and top-down reasoning. ## Bottom-up Example: ```text NVDA ↑ AMD ↑ AVGO ↑ Semiconductor breadth ↑ ↓ Semiconductor Sector Bullish ↓ Technology Sector Bullish ↓ QQQ Positive Contribution ↓ US Market Positive Contribution ``` --- # 31. TOP-DOWN PROPAGATION Example: ```text Hot CPI ↓ Fed Tightening Probability ↑ ↓ 2Y Yield ↑ 10Y Yield ↑ ↓ Growth Valuation Pressure ↑ ↓ Technology Negative Evidence ↓ QQQ Negative Evidence ↓ NVDA / TSLA / Growth Stocks Negative Context ``` This graph propagation is a major purpose of the ontology. --- # 32. PROPAGATION WEIGHTS Never assume every relationship has equal impact. Relationships should support: ```text influenceWeight holdingWeight sectorWeight marketCapWeight betaWeight correlationWeight confidence validity ``` Example: ```text NVDA --holdingContribution(7.8%)--> QQQ ``` Weight must be loaded dynamically from reliable data where available. Do not hard-code ETF weights permanently. --- # 33. TEMPORAL KNOWLEDGE GRAPH Every dynamic graph statement must be temporal. Example: ```text QQQ hasFactorObservation MACDObservation123 ``` where: ```text generatedAtTime eventTime validFrom validUntil ``` are available. Never treat a market inference as permanently true. --- # 34. GRAPH SNAPSHOTS Support named temporal graph snapshots. Example logical graphs: ```text graph:market/static graph:market/current graph:sector/current graph:instrument/current graph:factors/current graph:evidence/current graph:regime/current graph:provenance graph:history/2026-09-04 ``` The exact implementation should depend on the selected RDF database. --- # 35. RETENTION POLICY Do NOT retain unlimited high-frequency semantic observations in the hot graph. Implement configurable retention. Example: ```text 1-second factor observations: hot graph = short duration 1-minute: longer 5-minute: longer regime transitions: permanent historical record important event evidence: permanent historical record ``` Archive detailed history to: ```text ClickHouse TimescaleDB Parquet S3/MinIO ``` depending on architecture decisions. --- # 36. GRAPH STORE IS NOT THE RAW DATA LAKE Mandatory design principle: ```text Raw ticks Raw options Raw news text Raw social content Raw SEC documents ``` should NOT all be duplicated into RDF. Store raw data in appropriate stores. The graph should store: ```text semantic identity relationships derived observations important event references evidence regime provenance links back to raw source ``` --- # 37. NEWS DOCUMENT STORAGE For large news/social/filing content: ```text object storage / document database ``` should store the raw content. The graph stores: ```text document identity source timestamp entities claims events credibility sentiment impact content reference ``` --- # 38. FACTOR REGISTRY Create a Factor Registry similar to the Rule Registry. API examples: ```text GET /api/v1/factors GET /api/v1/factors/{factorId} GET /api/v1/factors/categories GET /api/v1/instruments/{symbol}/factors GET /api/v1/instruments/{symbol}/factors/active GET /api/v1/instruments/{symbol}/factors/history ``` --- # 39. FACTOR DEFINITION METADATA Each factor definition should contain: ```text factorId name category description calculationMethod requiredInputs expectedFrequency defaultWindow normalizationMethod directionInterpretation applicableAssetTypes version ``` --- # 40. FACTOR DEPENDENCY GRAPH Represent dependencies. Example: ```text MACD dependsOn EMA12 MACD dependsOn EMA26 ``` Another: ```text QQQHoldingContribution dependsOn QQQHoldings QQQHoldingContribution dependsOn ConstituentRegimes ``` This enables incremental recomputation. --- # 41. REAL-TIME INCREMENTAL REASONING When an event changes: ```text QQQ price ``` do not recompute: ```text all US market rules all fundamental rules all filing rules ``` Instead determine dependencies: ```text QQQ price │ ├─ VWAP ├─ MA ├─ MACD ├─ Bollinger ├─ support/resistance ├─ momentum └─ relevant QQQ rules ``` Then recompute affected evidence. --- # 42. FACTOR FRESHNESS Different factor types require different freshness decay. For example: ```text tick momentum: seconds/minutes MACD: minutes NFP: hours FOMC: hours/days 10-K: weeks/months earnings: days/weeks ``` Create configurable: ```text FreshnessPolicy ``` Example: ```text freshness = decay(age) ``` The contribution of stale information must automatically decrease. --- # 43. SIGNAL HALF-LIFE Support: ```text signalHalfLife ``` for factors. Example: ```text BreakingNews: 15 minutes TechnicalBreakout: 5 minutes NFP: several hours 10-K fundamental change: weeks ``` Do not use these example numbers as permanent defaults without research/backtesting. Make configurable. --- # 44. CONTEXT-AWARE FACTOR WEIGHTING Factor importance changes by regime. Example: During NFP: ```text macro Treasury price volume ``` weights increase. During ordinary mid-day trading: ```text technical options volume breadth ``` may dominate. Before earnings: ```text options earnings expectations company-specific news ``` may dominate. Implement context-sensitive weighting. --- # 45. GRAPH REGIME COMPUTATION Compute: ## Instrument regime from instrument factors. ## Sector regime from: ```text sector instruments sector ETF breadth sector-specific macro factors ``` ## US market regime from: ```text sector regimes market breadth SPY QQQ IWM DIA Treasuries VIX DXY macro liquidity ``` --- # 46. AVOID CIRCULAR DOUBLE COUNTING This is critical. Example: ```text NVDA → Technology → QQQ → Technology ``` can create cycles. Implement lineage-aware propagation. Do not allow the same underlying evidence to contribute multiple times through different graph paths without adjustment. Every propagated evidence object must retain: ```text originEvidenceId path propagationDepth ``` The regime engine must detect duplicate ancestry. --- # 47. PROVENANCE PATH The application must be able to show: ```text NFP report ↓ NFP surprise observation ↓ Labor cooling evidence ↓ 2Y Treasury decline ↓ Growth valuation evidence ↓ Technology evidence ↓ QQQ evidence ↓ QQQ bullish regime ``` Every edge must be queryable. --- # 48. EXAMPLE TECHNICAL PATH ```text ThetaData trade ticks ↓ 5-minute window ↓ EMA5 EMA9 ↓ EMA5 > EMA9 ↓ BullishMomentumEvidence ↓ QQQ Regime Score +0.07 ``` The application must expose this explanation. --- # 49. EXAMPLE NEWS PATH ```text News article ↓ Entity Linking ↓ Tesla ↓ Event = production increase ↓ Credibility = highly corroborated ↓ Sentiment = positive ↓ Expected relevance = high ↓ TSLA News Evidence ↓ TSLA Regime Contribution ``` --- # 50. EXAMPLE SOCIAL PATH ```text Verified executive account ↓ Public post ↓ Entity / event extraction ↓ Tesla ↓ Product announcement ↓ Cross-source corroboration ↓ Credibility assessment ↓ ExecutiveCommunicationEvidence ↓ TSLA factor contribution ``` --- # 51. GRAPH APIs Add: ```text GET /api/v1/graph/market GET /api/v1/graph/sectors GET /api/v1/graph/sector/{sector} GET /api/v1/graph/instrument/{symbol} GET /api/v1/graph/instrument/{symbol}/factors GET /api/v1/graph/instrument/{symbol}/evidence GET /api/v1/graph/instrument/{symbol}/regime GET /api/v1/graph/instrument/{symbol}/explain GET /api/v1/graph/path/{evidenceId} GET /api/v1/graph/factor/{factorId} ``` --- # 52. GRAPH UI Create an interactive real-time graph explorer. The user must be able to drill: ```text US MARKET ↓ TECHNOLOGY ↓ QQQ ↓ MACD ``` or: ```text US MARKET ↓ CONSUMER DISCRETIONARY ↓ TSLA ↓ EXECUTIVE POST ``` --- # 53. UI LEVEL 0 Display: ```text US MARKET Regime Confidence Breadth SPY QQQ IWM VIX 2Y 10Y Sector heatmap ``` Clicking a sector navigates to Level 1. --- # 54. UI LEVEL 1 Example: ```text TECHNOLOGY Regime: BULLISH Breadth: 73% Relative Strength: +0.62 Top Positive Contributors: NVDA MSFT AAPL Top Negative Contributors: ... Top Factors: Treasuries Semiconductors AI News Options ``` --- # 55. UI LEVEL 2 Example: ```text QQQ REGIME: STRONG_BULLISH 1M 5M 15M 1H 1D PRICE SUPPORT RESISTANCE EVENT MODE RISK ``` Then show Level-3 contributing factors. --- # 56. UI LEVEL 3 — CONTRIBUTOR DASHBOARD Provide categories: ```text TECHNICAL OPTIONS MACRO MICRO FUNDAMENTALS SEC FILINGS NEWS SOCIAL SECTOR HOLDINGS CROSS-ASSET VOLATILITY ``` Each category displays: ```text factor direction score confidence freshness contribution ``` --- # 57. TOP CONTRIBUTORS For every regime display: ```text TOP POSITIVE FACTORS TOP NEGATIVE FACTORS TOP UNCERTAIN FACTORS ``` Example: ```text QQQ STRONG BULLISH Positive 2Y yield decline +0.16 QQQ > VWAP +0.13 NVDA strength +0.11 MA5/9 bullish +0.08 MACD +0.07 Negative High IV -0.05 Resistance proximity -0.04 ``` --- # 58. CONTRIBUTION VISUALIZATION Display real-time contribution bars. The graph and dashboard should allow the user to see: ```text Why is the price moving? ``` rather than only: ```text What is the price doing? ``` --- # 59. IMPACT HEAT PROPAGATION Implement an optional visual propagation mode. Example: ```text Hot CPI ``` should visually propagate through: ```text Treasuries ↓ Technology ↓ QQQ ↓ Growth Stocks ``` Use intensity based on normalized influence score. The visual layer may use: ```text green = positive contribution red = negative contribution neutral = insignificant/uncertain ``` while ensuring accessibility and text labels are also available. --- # 60. KNOWLEDGE GRAPH RELATIONSHIPS Define at minimum relationships similar to: ```text hasSector hasIndustry hasMember hasHolding tracksIndex representedByETF affectedBy influencedBy hasFactor hasFactorObservation derivedFrom supportsEvidence contradictsEvidence supportsRegime opposesRegime propagatesTo dependsOn correlatedWith sensitiveTo triggeredBy reportedBy authoredBy executiveOf mentions aboutInstrument aboutSector hasCredibilityAssessment ``` --- # 61. SEMANTIC OBSERVATION EXAMPLE Example RDF: ```turtle obs:QQQ_MACD_20260904_103115 a market:TechnicalFactorObservation ; market:forInstrument instrument:QQQ ; market:factorDefinition factor:MACD ; market:eventTime "2026-09-04T10:31:15-04:00"^^xsd:dateTime ; market:horizon "PT5M" ; market:value 1.24 ; market:direction regime:Bullish ; market:normalizedScore 0.62 ; market:confidence 0.93 ; market:freshness 0.99 . ``` --- # 62. NEWS OBSERVATION EXAMPLE ```turtle obs:News_123 a market:NewsFactorObservation ; market:aboutInstrument instrument:TSLA ; market:eventType event:ProductAnnouncement ; market:sentimentScore 0.74 ; market:credibilityScore 0.91 ; market:marketRelevance 0.86 ; market:direction regime:Bullish ; prov:wasDerivedFrom source:NewsArticle123 . ``` --- # 63. AGENTS — EXTEND PREVIOUS AGENT ARCHITECTURE Keep all agents from the previous specification. Add the following specialized agents. ## Agent 13 — Market Graph Architect Responsibilities: ```text Level 0-3 graph hierarchy instrument relationships sector relationships ETF holdings graph propagation temporal graph semantic graph optimization ``` --- ## Agent 14 — News Intelligence Agent Responsibilities: ```text news normalization entity linking event extraction sentiment novelty impact deduplication ``` --- ## Agent 15 — Information Verification Agent Responsibilities: ```text source assessment corroboration contradiction detection spam detection misinformation-risk scoring provenance validation ``` It must NOT independently declare uncertain claims to be absolute facts. --- ## Agent 16 — Fundamentals & Filings Agent Responsibilities: ```text 10-K 10-Q 8-K 13F Form 4 fundamentals company event extraction financial-statement semantic mapping ``` --- ## Agent 17 — Social Intelligence Agent Responsibilities: ```text social feeds executive account identification entity linking event extraction credibility sentiment market relevance ``` --- ## Agent 18 — Graph Propagation Agent Responsibilities: ```text factor propagation ETF holding propagation sector propagation market propagation lineage cycle prevention double-count prevention ``` --- # 64. CLAUDE SKILL ENHANCEMENT Extend: ```text .claude/skills/semantic-market-regime/ ``` with: ```text graph/ hierarchy.md factor-model.md propagation.md temporal-graph.md news/ news-intelligence.md credibility.md social/ social-intelligence.md filings/ sec-filings.md factors/ technical.md macro.md options.md fundamentals.md templates/ factor-definition.yaml factor-rule.yaml propagation-rule.yaml ``` SKILL.md must explicitly teach future agents: ```text how Level 0-3 works how factors are represented how temporal observations work how evidence is generated how propagation works how double counting is prevented how provenance is preserved ``` --- # 65. DATA SOURCE ABSTRACTION Create independent provider interfaces. Examples: ```text MarketDataProvider OptionsDataProvider MacroDataProvider NewsProvider SocialProvider FundamentalProvider FilingProvider ETFHoldingsProvider ``` Do not tightly couple reasoning to any single data vendor. --- # 66. SOURCE CONFIDENCE Every source should have configurable metadata. Example: ```text SourceDefinition sourceType provider reliability latency license coverage ``` Do not assume equal reliability. --- # 67. EVENT DEDUPLICATION One news event may appear through: ```text Reuters Bloomberg other news sites social posts ``` Do NOT count it as four independent bullish factors if they describe the same underlying event. Create: ```text CanonicalMarketEvent ``` and link multiple observations to the same event. --- # 68. CANONICAL EVENT MODEL Example: ```text Tesla Delivery Announcement │ ┌─────┼─────┐ │ │ │ News Social Official ``` All sources can corroborate a single: ```text CanonicalMarketEvent ``` This prevents signal inflation. --- # 69. MARKET CAUSAL GRAPH VS CORRELATION The graph must distinguish: ```text observed association semantic dependency historical correlation rule-based influence hypothesis verified corporate relationship ``` Never incorrectly label correlation as proven causation. Create relationship metadata such as: ```text relationshipType confidence source method validFrom validUntil ``` --- # 70. GRAPH PERFORMANCE Design for: ```text thousands of instruments hundreds of factor definitions millions of historical factor observations high-frequency updates ``` Do not issue huge unrestricted SPARQL queries on every event. Use: ```text dependency indexes caching current-state graphs incremental updates precomputed aggregates bounded queries ``` --- # 71. GRAPH CACHE Maintain fast current-state materializations. Examples: ```text latest regime per symbol latest factor per symbol/factor latest evidence active support/resistance sector regime market regime ``` Redis may be used for this layer. --- # 72. REAL-TIME REASONING EXAMPLE — QQQ The complete system should support: ```text NFP misses expectations ↓ NFP surprise = -0.91 Z ↓ 2Y yield drops ↓ 10Y drops ↓ Macro contribution = +0.16 QQQ MA5 > MA9 ↓ Technical contribution = +0.07 QQQ MACD bullish ↓ Technical contribution = +0.06 QQQ > VWAP ↓ Technical contribution = +0.11 NVDA strong ↓ Holding contribution = +0.08 Semiconductors strong ↓ Sector contribution = +0.07 Options supportive ↓ Options contribution = +0.05 Negative news absent ↓ FINAL NORMALIZED SCORE +0.73 QQQ REGIME STRONG_BULLISH CONFIDENCE 0.86 ``` --- # 73. REAL-TIME REASONING EXAMPLE — TSLA Possible example: ```text NASDAQ bullish +0.08 Consumer discretionary bullish +0.05 MA5 < MA9 -0.07 Price below VWAP -0.11 Put flow elevated -0.12 Executive post positive +0.05 News credibility uncertain 0.00 10Y yield rising -0.08 Resistance rejection -0.10 ``` Result: ```text TSLA = BEARISH ``` even if the overall market is bullish. This demonstrates why Level-3 factors are essential. --- # 74. USER QUERY SUPPORT The AI agent must answer: ```text What is the US market regime? Which sector is strongest? Why is technology bullish? Why is QQQ moving higher? What factors are currently affecting TSLA? Show only macro factors affecting QQQ. Show only technical factors. What did the 5/9 MA algorithm infer? What did MACD infer? What does Bollinger indicate? What news is affecting TSLA? Is that news corroborated? Did a company executive post anything relevant? What did the latest 10-K change? Which factors contradict the current bullish regime? What factor has the highest contribution? What would invalidate the regime? Show the complete reasoning path. ``` --- # 75. GRAPH QUERY EXAMPLE Provide SPARQL examples. For example conceptually: ```sparql SELECT ?factor ?direction ?contribution ?confidence WHERE { ?observation market:forInstrument instrument:QQQ ; market:factorDefinition ?factor ; market:direction ?direction ; market:contribution ?contribution ; market:confidence ?confidence . } ORDER BY DESC(ABS(?contribution)) ``` Adapt syntax to valid SPARQL implementation. --- # 76. GRAPH DRILLDOWN API The frontend must efficiently request only required graph portions. Do NOT return the complete US financial knowledge graph to the browser. Use bounded expansions such as: ```text depth = 1 depth = 2 factor category time window minimum contribution minimum confidence ``` --- # 77. DOCKER SERVICES Extend the earlier Docker design as appropriate. Logical capabilities now include: ```text market-ingestor macro-ingestor news-ingestor social-ingestor filing-ingestor stream-engine semantic-projector rule-engine regime-engine graph-api backend frontend ``` These do NOT necessarily need to become separate physical microservices. First inspect the current application. Prefer modularity without unnecessary distributed-system complexity. --- # 78. SIMULATION The simulator must now generate: ```text price volume options macro events news social posts fundamental events sector events ``` to prove the complete graph. Include both: ```text credible news low-credibility news ``` to validate the credibility system. --- # 79. DEMO MARKET GRAPH Create a deterministic demo containing: ```text US Market Technology Consumer Discretionary SPY QQQ TSLA NVDA AAPL MSFT ``` plus factor observations. This should demonstrate L0 → L1 → L2 → L3 navigation. --- # 80. GRAPH TESTING Mandatory tests include: ```text USMarket → Sector relationship Sector → Instrument relationship ETF → Holding relationship Instrument → FactorObservation FactorObservation → Evidence Evidence → Regime Regime → Provenance ``` --- # 81. PROPAGATION TESTING Test: ```text stock → ETF stock → sector sector → market macro → sector macro → stock news → instrument social → instrument ``` --- # 82. DOUBLE-COUNT TESTING Create automated tests proving: ```text one underlying news event ``` cannot generate multiple full-strength contributions simply because five websites repeated the same news. Also prove: ```text NVDA bullish → semiconductor bullish → QQQ bullish ``` does not recursively re-enter NVDA and amplify itself. --- # 83. CREDIBILITY TESTING Test: ```text official source multiple corroborating sources single unknown source contradictory sources duplicate stories spam/social noise ``` --- # 84. TEMPORAL TESTING Validate that expired factors stop contributing. Example: ```text technical signal expired → contribution removed stale news → freshness decayed old filing → still available as fundamental context but lower event urgency ``` --- # 85. PERFORMANCE ACCEPTANCE CRITERIA Measure: ```text factor creation latency graph update latency rule evaluation latency factor-to-regime latency graph API latency UI update latency ``` Document test environment and results. --- # 86. ADDITIONAL ACCEPTANCE CRITERIA The previously defined acceptance criteria remain mandatory. Add: 31. Level-0 US Market node works. 32. Level-1 sectors work. 33. Level-2 instruments work. 34. Level-3 contributing factors work. 35. QQQ can display all currently active factors. 36. TSLA can display all currently active factors. 37. 5/9 MA produces semantic observations. 38. MACD produces semantic observations. 39. Bollinger produces semantic observations. 40. Fundamental factors work. 41. SEC filing observations work using test data. 42. News observations work. 43. News credibility assessment works. 44. Social observations work using test data/provider adapter. 45. Executive-account relationship works. 46. ETF holding propagation works. 47. Sector propagation works. 48. US-market propagation works. 49. Correlated-factor double counting is controlled. 50. Event deduplication works. 51. Factor freshness works. 52. Factor expiration works. 53. Graph lineage is queryable. 54. UI allows L0 → L1 → L2 → L3 drilldown. 55. User can ask "Why is QQQ bullish?" 56. User can ask "What is affecting TSLA right now?" 57. User can ask "Which news factor contributed?" 58. User can ask "Is that information corroborated?" 59. User can inspect exact rules involved. 60. Docker demo proves the entire chain. --- # 87. CRITICAL SYSTEM PRINCIPLE The system must always preserve: ```text SOURCE DATA ↓ NORMALIZED EVENT ↓ FEATURE / EVENT OBSERVATION ↓ ONTOLOGY ENTITY LINKING ↓ FACTOR OBSERVATION ↓ EVIDENCE ↓ PROPAGATION ↓ REGIME ↓ STRATEGY ↓ RISK ↓ RECOMMENDATION ↓ EXPLANATION ``` --- # 88. MARKET GRAPH PRINCIPLE The application must allow a human or AI agent to move in BOTH directions. Top-down: ```text US MARKET → SECTOR → STOCK/ETF → FACTORS ``` Bottom-up: ```text FACTOR → STOCK/ETF → SECTOR → US MARKET ``` This is mandatory. --- # 89. TARGET GRAPH EXPERIENCE When I open: ```text US MARKET ``` I should see every major sector and its regime. When I click: ```text Technology ``` I should see the major stocks/ETFs affecting it. When I click: ```text QQQ ``` I should see: ```text Technical factors Macro factors Options factors ETF holding factors News Fundamentals Filings Social Cross-asset factors Sector factors ``` When I click: ```text MACD ``` I should see: ```text current value previous value window direction score confidence contribution rule input data timestamp provenance ``` --- # 90. END GOAL The application is not merely: ```text a stock dashboard ``` It is: ```text A REAL-TIME FINANCIAL MARKET SEMANTIC REASONING GRAPH ``` where the system continuously understands: ```text WHAT is happening WHERE it is happening WHAT is influencing it HOW strong the influence is HOW reliable the information is HOW the influence propagates WHAT regime results WHY the regime was inferred WHAT would invalidate it ``` The knowledge graph must therefore function as the semantic brain of the market-intelligence application. --- # 91. FINAL CLAUDE FABLE INSTRUCTION Before implementing this enhancement: 1. Research current graph/stream reasoning approaches. 2. Analyze the existing application. 3. Analyze the previously implemented ontology/rule architecture. 4. Produce the updated graph architecture. 5. Produce the Factor Ontology. 6. Produce the propagation model. 7. Produce the temporal model. 8. Produce the news/social credibility model. 9. Produce the implementation plan. 10. Implement incrementally. 11. Write automated tests alongside implementation. 12. Run the complete application. 13. Execute Docker Compose. 14. Run the deterministic market simulation. 15. Verify L0 → L1 → L2 → L3. 16. Verify Factor → Evidence → Regime. 17. Verify propagation. 18. Verify provenance. 19. Verify no circular signal amplification occurs. 20. Verify news duplication does not inflate signals. 21. Verify stale factors expire. 22. Verify all APIs. 23. Verify frontend graph visualization. 24. Verify agents can query the graph. 25. Fix all discovered errors. 26. Re-run the full test suite. Do NOT declare completion until the implementation is actually runnable and validated. The final acceptance demonstration must show at minimum: ```text US MARKET ↓ TECHNOLOGY ↓ QQQ ↓ MA5/9 MACD BOLLINGER VWAP NFP 2Y TREASURY 10Y TREASURY NVDA CONTRIBUTION OPTIONS NEWS SOCIAL ↓ EVIDENCE ↓ QQQ REGIME ↓ STRATEGY ↓ RISK ↓ RECOMMENDATION ``` and another demonstration: ```text US MARKET ↓ CONSUMER DISCRETIONARY ↓ TSLA ↓ TECHNICAL OPTIONS MACRO FUNDAMENTALS SEC FILINGS NEWS EXECUTIVE SOCIAL POSTS ↓ CREDIBILITY ↓ EVIDENCE ↓ REGIME ↓ EXPLANATION ``` All previously specified Docker, Docker Compose, clean-code, testing, SHACL, OWL/RDF, rule governance, replay, backtesting, observability, security, provenance, agents, Claude Skill, CI, and documentation requirements remain mandatory.